
var execSync = require('child_process').execSync;
var fse = require('fs-extra');
var path = require('path');
var { name } = require('../package.json');


var branch = execSync('git symbolic-ref --short -q HEAD').toString()
branch = branch.replace('\n', '')
if (!fse.existsSync(path.resolve(__dirname, '../dist2'))) {
  fse.mkdirSync(path.resolve(__dirname, '../dist2'))
}
if (!fse.existsSync(path.resolve(__dirname, '../dist2', name))) {
  fse.mkdirSync(path.resolve(__dirname, '../dist2', name))
}
var [n, version] = branch.split('/')
if (n === 'release' && version) {
  console.log(path.resolve(__dirname, '../dist'))
  fse.copySync(path.resolve(__dirname, '../dist'), path.resolve(__dirname, '../dist2', name, version))
}
console.log('*' + branch + '*')